package exp1;

import java.text.SimpleDateFormat;
import java.util.Date;

class Timer extends Thread{
	SimpleDateFormat sdf=new SimpleDateFormat("yyyy年MM月dd日  HH:mm:ss");

	public void run(){
		while (true){
			System.out.print("\r现在时间是:");
			Date now =new Date();
			System.out.print(sdf.format(now));
			try{
				sleep(1000);
			}catch (InterruptedException e){
				e.printStackTrace();
			}
		}
	}
}

public class Clock{
	public static void main(String[] args){
		Timer timer = new Timer();
		timer.start();
	}
}